let baseUrl="http://localhost:8080/netdisc/user";
function httpGetWithParams(businessUrl, params, callback) {
    let url=baseUrl+businessUrl
    //http请求
    $.ajax({
        type:"get",
        url:url,
        data:params,
        success: function (resp) {
            handlerResp(resp,callback);
        }
    })
}
function httpGet(businessUrl, callback) {
    console.log("httpGet");
    let url = baseUrl + businessUrl;
    //无参数
    $.ajax({
        type: "GET",
        url: url,
        success: function (resp) {
            //http 获得结果
            console.log("===resp===");
            console.log(resp);
            //统一业务处理流程
            handlerResp(resp, callback);
        }
    });
}
function httpPostWithParams(businessUrl, params, callback) {
    let url=baseUrl+businessUrl

    $.ajax({
        type:"post",
        url:url,
        cache: false,
        data:params,
        processData:false,
        contentType:"application/json",
        success: function (resp) {
            handlerResp(resp,callback);
        }
    })
}
function httpPost(businessUrl,callback) {
    let url=baseUrl+businessUrl
    //无参
    $.ajax({
        type:"post",
        url:url,
        success: function (resp) {
            handlerResp(resp,callback);
        }
    })
}

/**
 * 返回结果
 */

function handlerResp(resp,callback) {
    callback(resp);
}
